﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using nplJobsCommon;
using nplJobs.DB;
using System.Data;
using nplJobsCommon.Common;

namespace nplJobsDAL.Select
{
    public class SelectAppliedJobs
    {
        public static List<JobListDetails> GetAppliedJobs(Int64 jobID, Guid JobSeekerID)
        {
            try
            {
                CustomParameterList cpList = new CustomParameterList();

                cpList.Add(new CustomParameter("@JobID", jobID, DbType.Int64));
                cpList.Add(new CustomParameter("@JobSeekerID", JobSeekerID, DbType.Guid));
               

                object paramval = null;
                DBHelper db = new DBHelper();
                DataTable dt = db.ExecuteQueryToDataTable(cpList.ParameterNames, cpList.ParameterValues, cpList.ParameterTypes, ref paramval, null, "spSelectAppliedJobs");

                List<JobListDetails> results = new List<JobListDetails>();
                foreach (DataRow dr in dt.Rows)
                {
                    JobListDetails objJobList = new JobListDetails();

                    MapperBase.GetInstance().MapItem(objJobList, dr); ;
                    results.Add(objJobList);
                }
                return results;

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
    }
}
